package com.cloud;

import com.cloud.mqtt.Emq.MQTTServer;
import com.cloud.mqtt.Emq.MQTTSubscribe;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;


@SpringBootApplication
@EnableAutoConfiguration
public class MqttApplication {

    // 接收订阅接口和消息，mqtt消费端
    private MQTTServer mqttServer;
    {
        try {
            mqttServer = new MQTTServer();
        } catch (MqttException e) {
            e.printStackTrace();
        }
    }

    @Autowired
    private MQTTSubscribe subscribe;
    {
        subscribe = new MQTTSubscribe();
//         订阅消息
        subscribe.init();
//         发布消息
//        mqttServer.publishMessage();
    }

    // public PushCallback pushCallback;

    public void consumeMqttClient(){

    }

    public static void main(String[] args) {
        SpringApplication.run(MqttApplication.class, args);
    }

}
